import http from './xhttp'

export default {
  login: (username, password) => http.post('/v1/login', {username, password}),
  register: (username, password) => http.post('/v1/register', {username, password}),
  getArticles: (username) => http.get('/v1/articles', {params: {username}}),
  getArticleById: (articleId) => http.get('v1/articles', {params: {articleId}}),
  createArticle: (info) => http.post('/v1/new-article', info),
  uploadImg: (param) => http.post('v1/uploadImg', param),
  editArticle: (param) => http.post('v1/edit-article', param),
  updateArticle: (info) => http.post('/v1/edit-article', info),
  delArticle: (id) => http.get('/v1/del-article', {params: {id}})
}
